//
// Created by Semir on 2020/6/6.
//

#include <iostream>
#include <set>
#include <vector>

using namespace std;

void FindNumsAppearOnce(vector<int> data, int* num1, int *num2) {
    set<int> auxSet;
    for (auto i : data) {
        if (auxSet.count(i) > 0) {
            auxSet.erase(i);
        } else {
            auxSet.insert(i);
        }
    }
    *num1 = *auxSet.begin();
    *num2 = *(++auxSet.begin());
    set<int>().swap(auxSet);
}

int main() {
    vector<int> data = {1, 3, 1, 3, 4, 5, 5, 2, 4, 8};
    int *num1 = new int;
    int *num2 = new int;
    FindNumsAppearOnce(data, num1, num2);
    cout << *num1 << " " << *num2 << endl;
    return 0;
}